﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Navigation;
using System.Windows.Shapes;
using Controls.LiveControl;

namespace ControlWpf
{
    /// <summary>
    /// UserControl1.xaml 的交互逻辑
    /// </summary>
    public partial class WpfGdiScreen : UserControl
    {
        //private Bitmap Screen { get; set; }
        private BitmapImage Screen { get; set; }
        private ScreenStatus _screenStatus;
        public WpfGdiScreen()
        {
            InitializeComponent();
        }

        protected override void OnRender(DrawingContext drawingContext)
        {
            base.OnRender(drawingContext);
            var rectangle = new Rect(new Point(0, 0), this.RenderSize);
            switch (_screenStatus)
            {
                case ScreenStatus.FullScreen:
                    drawingContext.DrawImage(Screen, rectangle);
                    break;
                case ScreenStatus.OnlyShowProcAndFit:
                    //drawingContext.DrawImage(Screen, rectangle, _srcRectangle);
                   
                    break;
                case ScreenStatus.OnlyShowProcNotFit:
                    //drawingContext.DrawRectangle(Brushes.Gray,null, new Rect(new Point(0,0),this.RenderSize));
                    //drawingContext.DrawImage(Screen, GetScreenRectangle(_srcRectangle), _srcRectangle, GraphicsUnit.Pixel);
                    break;
                default:
                    throw new ArgumentOutOfRangeException();
            }
        }

    }
}
